home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 January: Mac OS SDK / Dev.CD Jan 99 SDK1.toast / Development Kits / Interfaces&Libraries / OpenTransport / Open Tpt Protocol Developer / Includes / OTSharedLibs.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-11-24  |  3.8 KB  |  128 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        OTSharedLibs.h
  3.  
  4.     Contains:    This file contains prototypes for helpful routines for loading
  5.                 shared libraries.
  6.  
  7.     Copyright:    © 1994-1997 by Apple Computer, Inc., all rights reserved.
  8.  
  9.  
  10. */
  11.  
  12. #ifndef __OTSHAREDLIBS__
  13. #define __OTSHAREDLIBS__
  14.  
  15. #ifndef __OPENTRANSPORT__
  16. #include <OpenTransport.h>
  17. #endif
  18.  
  19. /*******************************************************************************
  20. ** Declarations
  21. ********************************************************************************/
  22.  
  23. typedef struct CFragInitBlock    CFragInitBlock;
  24.  
  25. typedef FSSpec     OTFileSpec;
  26.  
  27. enum
  28. {
  29.     kOTGetDataSymbol    = 0,
  30.     kOTGetCodeSymbol    = 1,
  31.     kOTLoadNewCopy        = 2,
  32.     kOTLoadACopy        = 4,
  33.     kOTFindACopy        = 8,
  34.     kOTLibMask            = kOTLoadNewCopy | kOTLoadACopy | kOTFindACopy,
  35.     kOTLoadLibResident    = 0x20
  36. };
  37.  
  38. /*******************************************************************************
  39. ** Some CFM Tags
  40. ********************************************************************************/
  41.  
  42. #define kOTCFMTag                'otan'
  43.  
  44. #define kOTPortScannerCFMTag                kOTKernelPrefix "pScnr"
  45. #define kOTPseudoPortScannerCFMTag            kOTKernelPrefix "ppScnr"
  46. #define kOTCompatPortScannerCFMTag            kOTKernelPrefix "cpScnr"
  47. #define kOTConfiguratorCFMTag                kOTClientPrefix "cfigMkr"
  48.  
  49. /*
  50.  * A list of these structures is returned by the OTSearchForCFMLibrary routine.
  51.  * The list is created out of the data that is passed to the function.
  52.  * Note that only the first 3 fields are valid when using OT 1.2 and older.
  53.  */
  54.  
  55. struct CFMLibraryInfo {
  56.     OTLink                             link;                        /* To link them all up on a list                    */
  57.     char *                            libName;                    /* "C" String which is fragment name                */
  58.     StringPtr                         intlName;                    /* Pascal String which is internationalized name    */
  59.     OTFileSpec *                    fileSpec;                    /* location of fragment's file */
  60.     StringPtr                         pstring2;                    /* Secondary string from extended cfrg                */
  61.     StringPtr                         pstring3;                    /* Extra info from extended cfrg                    */
  62. };
  63. typedef struct CFMLibraryInfo CFMLibraryInfo;
  64.  
  65. /*******************************************************************************
  66. ** Functions for dealing with CFM
  67. ********************************************************************************/
  68.  
  69. #ifdef __cplusplus
  70. extern "C" {
  71. #endif
  72.  
  73.     typedef void*     (*OTAllocMemProcPtr)(size_t);
  74.     typedef void     (*OTFreeMemProcPtr)(void*);
  75.     
  76.     //
  77.     // Find CFM libraries of the specified kind and type
  78.     //
  79.     extern OSStatus    OTFindCFMLibraries(OSType libKind, const char* type, OTList* theList, OTAllocMemProcPtr);
  80.     //
  81.     // Load a CFM library by name
  82.     //
  83.     extern OSStatus    OTLoadCFMLibrary(const char* libName, UInt32* connID, UInt32 type);
  84.     //
  85.     // Load a CFM library and get a named pointer from it
  86.     //
  87.     extern void*    OTGetCFMPointer(const char* libName, const char* entryName, UInt32* connID, UInt32 type);
  88.     //
  89.     // Get a named pointer from a CFM library that's already loaded
  90.     //
  91.     extern void*    OTGetCFMSymbol(const char* entryName, UInt32 connID, UInt32 type);
  92.     //
  93.     // Release a connection to a CFM library
  94.     //
  95.     extern void        OTReleaseCFMConnection(UInt32* connID);
  96.     //
  97.     // Load an ASLM library
  98.     //
  99.     extern OSStatus    OTLoadASLMLibrary(const char* libName);
  100.     //
  101.     // Unload an ASLM library
  102.     //
  103.     extern void        OTUnloadASLMLibrary(const char* libName);
  104.  
  105. #if !GENERATING68K
  106.     //
  107.     // Used in a CFM InitProc, will hold the executable code, if applicable.
  108.     // This can also be the InitProc of the library
  109.     //
  110.     extern OSStatus    OTHoldThisCFMLibrary(CFragInitBlock*);
  111.     //
  112.     // Used in a CFM terminate proc, will unhold the executable code, if applicable.
  113.     // This can also be the terminate proc of the library
  114.     //
  115.     extern void        OTUnholdThisCFMLibrary(void);
  116. #endif
  117. /*
  118.  * This is an ASLM utility routine.  You can get it by including LibraryManagerUtilities.h, but since
  119.  * we only use a few ASLM utilities, we put the prototype here for convenience.
  120.  */
  121. void    UnloadUnusedLibraries(void);
  122.  
  123. #ifdef __cplusplus
  124. }
  125. #endif
  126.  
  127. #endif
  128.